<template>
    <div class="public-common">
        <!--驾驶员信息管理-->
        <div class="public-title">驾驶员列表</div>
        <div style="padding:10px;">
            <el-row>
                <el-col :span="6">
                    <el-input placeholder="请输入内容" v-model="form.test" class="input-with-select"/>
                </el-col>
                <el-col :span="18">
                    <el-button type="primary" icon="el-icon-search" style="margin-left:10px;">搜索</el-button>
                    <el-button type="success" icon="el-icon-edit-outline">新建</el-button>
                    <el-button type="danger" icon="el-icon-delete">删除</el-button>
                    <el-button type="danger" icon="el-icon-delete">注销</el-button>
                    <el-button type="warning" icon="el-icon-paperclip">导入数据</el-button>
                    <el-select v-model="form.changevalue" placeholder="请选择" style="width:120px;margin-left:10px">
                        <el-option
                        v-for="item in select.keywords"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                        </el-option>
                    </el-select>
                </el-col>
            </el-row>
        </div><el-table :data="tabledata" size="mini" border stripe header-row-class-name="textcenter">
            <el-table-column
            type="selection"
            width="55" fixed="left">
            </el-table-column>
            <el-table-column
                label="数据来源">
                <template slot-scope="scope">
                    {{scope.row.companyName}}
                </template>
            </el-table-column>
            <el-table-column
                label="姓名">
                <template slot-scope="scope">
                    {{scope.row.carId}}
                </template>
            </el-table-column>                
            <el-table-column
                label="性别">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="是否承包人">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="所属单位">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="照片">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="出生日期">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="民族">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="籍贯">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="文化程度">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="身份证号">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="现住址">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="联系电话">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="驾驶证编号">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="准驾车型">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="初次领证日期">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="驾驶证有效期">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="驾照有效年限">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="资格证号">
                <template slot-scope="scope">
                    {{scope.row.companyName}}
                </template>
            </el-table-column>
            <el-table-column
                label="资格证发证日期">
                <template slot-scope="scope">
                    {{scope.row.carId}}
                </template>
            </el-table-column>                
            <el-table-column
                label="服务监督卡类型">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="服务监督卡办理时间">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="学期">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="学号">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="备案证号">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="备案证发证日期">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="档案编号">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="备注">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="使用状态">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="创建人">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="创建时间">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="操作" fixed="right">
                <template slot-scope="scope">
                    <el-button type="primary" size="mini">编辑</el-button>
                </template>
            </el-table-column> 
            
        </el-table>
        <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.now"
        :page-sizes="page.sizes"
        :page-size="page.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total" style="margin-top:10px;">
        </el-pagination>
        <!--dialog-->
        <el-dialog  :visible.sync="dialog.isVisible" width="60%" top="8vh">
            <div class="dialog-navtab">
                <div v-for="(name,index) in dialog.navtab.arr" :key="index" :class="index==dialog.navtab.currIndex?'dialog-navactive':''" @click="dialogNav(index)">
                    {{name}}
                </div>
            </div>
            <el-scrollbar style="height:350px;">
            <template v-if="dialog.navtab.currIndex == 0">
                
                    <el-form label-width="120px">
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="姓名">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="上传照片">
                                    <el-upload
                                    class="upload-demo"
                                    action="#"
                                    :limit="1"
                                    :auto-upload="false"
                                    :show-file-list="false"
                                    :on-change="uploadImg">
                                    <el-button size="small" type="primary">点击上传</el-button>
                                    <!-- <div slot="tip" class="el-upload__tip" style="line-height:18px;">建议照片大小为小2寸最佳(长×宽为45mm×35mm)</div> -->
                                    </el-upload>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="性别">
                                    <el-select v-model="dialog.name" placeholder="请选择" style="width:100%">
                                        <el-option
                                        v-for="item in select.sexs"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="照片">
                                    <div style="position:absolute;">
                                        <img :src="dialog.picSrc" alt="" style="width:110px;height:146px;float:left">
                                        <div style="margin-left:120px;margin-top:10px;line-height:22px;">建议照片大小为小2寸最佳<br>(长×宽为45mm×35mm)</div>
                                    </div>                            
                                </el-form-item>
                            </el-col>
                        </el-row>  
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="出生日期">
                                    <el-date-picker
                                    v-model="dialog.name"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="民族">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="籍贯">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="所属单位">
                                    <el-select v-model="dialog.name" placeholder="请选择" style="width:100%">
                                        <el-option
                                        v-for="item in select.companys"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="学期">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="学历">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="学号">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="政治面貌">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="备案证发证日期">
                                    <el-date-picker
                                    v-model="dialog.name"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                                
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="是否已婚">
                                    <el-select v-model="dialog.name" placeholder="请选择" style="width:100%">
                                        <el-option
                                        v-for="item in select.ismarry"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="驾驶证编号">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="户口所在地">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="准驾车型">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="驾龄">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="初次领证日期">
                                    <el-date-picker
                                    v-model="dialog.name"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                                
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="身份证号">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="驾驶证有效期">
                                    <el-date-picker
                                    v-model="dialog.name"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                                
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="联系电话">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="驾照有效年限">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="现住址">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="资格证发证日期">
                                    <el-date-picker
                                    v-model="dialog.name"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="档案编号">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="备注">
                                    <div style="position:absolute;width:100%">
                                        <el-input type="textarea" :rows="2" v-model="dialog.name" readonly></el-input>                            
                                    </div>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="资格证号">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="备案证号">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="使用状态">
                                    <el-select v-model="dialog.name" placeholder="请选择" style="width:100%">
                                        <el-option
                                        v-for="item in select.useStates"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="是否承包人">
                                    <el-select v-model="dialog.name" placeholder="请选择" style="width:100%">
                                        <el-option
                                        v-for="item in select.contractors"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="注销时间">
                                    <el-date-picker
                                    v-model="dialog.name"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="创建时间">
                                    <el-date-picker
                                    v-model="dialog.name"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="注销人">
                                    <el-input v-model="dialog.name"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="创建人">
                                    <el-select v-model="dialog.name" placeholder="请选择" style="width:100%">
                                        <el-option
                                        v-for="item in select.creaters"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>                          
                    </el-form>
                </template>
                <template v-else-if="dialog.navtab.currIndex == 1">
                    <div class="public-title"><el-button type="success" size="mini" style="margin-top:3px;" @click="addNewdata(1)" icon="el-icon-plus">新增家庭成员</el-button> </div>
                    <el-table :data="dialog.tabledata1" size="mini" border stripe header-row-class-name="textcenter" max-height="370px">
                        <el-table-column
                            label="姓名">
                            <template slot-scope="scope">
                                {{scope.row.carId}}
                            </template>
                        </el-table-column>                
                        <el-table-column
                            label="关系">
                            <template slot-scope="scope">
                                {{scope.row.carType}}
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="工作单位或住址" >
                            <template slot-scope="scope">
                                {{scope.row.companyName}}
                            </template>
                        </el-table-column>             
                        <el-table-column
                            label="操作" fixed="right">
                            <template slot-scope="scope">
                                <el-button type="danger" icon="el-icon-delete" size="mini">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </template>
                <template v-else>
                    <div class="public-title"><el-button type="success" size="mini" style="margin-top:3px;" @click="addNewdata(0)" icon="el-icon-plus">新增工作机会</el-button> </div>
                    <el-table :data="dialog.tabledata2" size="mini" border stripe header-row-class-name="textcenter" max-height="370px">
                        <el-table-column
                            label="公司名称">
                            <template slot-scope="scope">
                                {{scope.row.carId}}
                            </template>
                        </el-table-column>                
                        <el-table-column
                            label="工作年限">
                            <template slot-scope="scope">
                                {{scope.row.carType}}
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="备注" >
                            <template slot-scope="scope">
                                {{scope.row.companyName}}
                            </template>
                        </el-table-column>             
                        <el-table-column
                            label="操作" fixed="right">
                            <template slot-scope="scope">
                                <el-button type="danger" icon="el-icon-delete" size="mini">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </template>
            </el-scrollbar>
            <div class="textcenter">
                <el-button type="primary">确定</el-button>  
                <el-button type="info" @click="dialog.isVisible = false">返回</el-button>
            </div>
            <!--内部弹窗-->
            <el-dialog
            width="35%"
            :title="dialog.dialog.type == 1?'新增家庭主要成员':'新增工作机会'"
            :visible.sync="dialog.dialog.isVisible"
            append-to-body>
                <el-form label-width="120px" v-if="dialog.dialog.type == 1">
                    <el-form-item label="姓名">
                        <el-input v-model="dialog.dialog.name"></el-input>
                    </el-form-item>
                    <el-form-item label="关系">
                        <el-input v-model="dialog.dialog.relationship"></el-input>
                    </el-form-item>
                    <el-form-item label="工作单位或住址">
                        <el-input v-model="dialog.dialog.address"></el-input>
                    </el-form-item>                   
                </el-form>
                <el-form label-width="120px" v-else>
                    <el-form-item label="公司名称">
                        <el-input v-model="dialog.dialog.coname"></el-input>
                    </el-form-item>
                    <el-form-item label="工作年限">
                        <el-input v-model="dialog.dialog.year"></el-input>
                    </el-form-item>
                    <el-form-item label="备注">
                        <el-input v-model="dialog.dialog.mark"></el-input>
                    </el-form-item>                 
                </el-form>
                <div class="textcenter">
                    <el-button type="primary">确定</el-button>  
                    <el-button type="info" @click="dialog.dialog.isVisible = false">返回</el-button>
                </div>
            </el-dialog>
        </el-dialog>
    </div>
</template>
<script>
export default {
    data(){
        return {
            form:{
                changevalue:"全部",
                test:'',
                carid:''
            },
            tabledata:[
                {carId:1}
            ],
            page:{
              now:1,
              pagesize:10,
              sizes:[2,10, 20, 50, 100],
              total:0,
              key:''
            },
            detaildata:[],
            dialog:{
                isVisible:false,
                navtab:{
                    arr:['驾驶员基本信息','家庭主要成员','本人工作经历'],
                    currIndex:0
                },
                picSrc:'test',
                name:'',
                dialog:{
                    isVisible:false,
                    type:1,//1:家庭成员 ； 0:工作单位
                    name:'',
                    relationship:'',
                    address:'',
                    coname:'',
                    year:'',
                    mark:''
                }
            },
            select:{
                keywords:[
                    {label:"全部",value:'全部'},
                    {label:"启用",value:'启用'},
                    {label:"已注销",value:'已注销'},
                    {label:"身份证15位",value:'身份证15位'},
                    {label:"身份证18位",value:'身份证18位'}
                ],
                companys:[],
                ismarry:[
                    {label:"是",value:"是"},
                    {label:"否",value:"否"}
                    ],
                contractors:[
                    {label:"是",value:"是"},
                    {label:"否",value:"否"}
                ],
                sexs:[
                    {label:"男",value:'男'},
                    {label:"女",value:'女'}
                ],
                creaters:[],
                useStates:[
                    {label:"启用",value:'启用'},
                    {label:"禁用",value:'禁用'}
                ]
            }
        }
    },
    mounted(){
        
    },
    methods:{
        dialogNav(index){
            this.dialog.navtab.currIndex = index;
        },
        uploadImg(file, fileList){
            let reader = new FileReader();
            reader.onload = ()=>{
                let base64 = reader.result;
                let _base64 = base64.split(',');
                this.dialog.picSrc = 'data:image/jpeg;base64,'+_base64[1];
            }
            reader.readAsDataURL(file.raw);
        },
        addNewdata(type){
            this.dialog.dialog.type = type ;
            this.dialog.dialog.isVisible = true;
        },
        search(){
            alert("search")
        },
        //分页
        handleSizeChange(pagesize){
            this.page.pagesize = pagesize;
            this.search(true,true);
        },
        handleCurrentChange(pageno){
            this.page.now = pageno;
            this.search(true,true);
        }

    }
}
</script>
<style lang="scss">
$Color:#15428F;
$Bgnavtab:rgba(255,255,255,.5);
$BgHeader:#DFE8F6;
$BorderColor:#99bbe8;
.public-common{
    padding: 20px;
    .public-title{line-height: 30px;background-color: #deecfd;padding:0 10px;color:$Color; }
}
</style>